package edu.gmu.projects.fireresponder.environment;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

public class Safespot extends Asset {
	final int TIME_TO_COMPLETE = 300;
	private Location safespot;
	private Set<Asset> connectedAssets;

	public Safespot() {
		safespot = new Location();
		connectedAssets = new HashSet<Asset>();
	}

	public void setSafespot(Location safespot) {
		this.safespot = safespot;
		connectedAssets = new HashSet<Asset>();
	}

	public Location getSafespot() {
		return safespot;
	}

	public int getEstimatedTimeToComplete() {
		return TIME_TO_COMPLETE;
	}

	public Set<Location> getPoints() {
		Set<Location> points = new HashSet<Location>();
		points.add(safespot);

		return points;
	}

	public int compareTo(Asset o) {
		if(o instanceof Safespot) {
			return getCenter().compareTo(o.getCenter());
		}
		return -1;
	}

	public Location getCenter() {
		return safespot;
	}
	
	public void addConnectedAsset(Asset asset) {
		connectedAssets.add(asset);
	}

	public Collection<Asset> getConnectedAssets() {
		return connectedAssets;
	}
	
	public String toString() {
		return "Safe Spot: " + getId();
	}

}